﻿using System.Collections.Generic;
using CCS.BLL.DTO;
using CCS.DAL.Repository;
using CCS.DAL.Repository.Impl;
using CIK.Framework.Extensions;

namespace CCS.BLL.Impl
{
    public class ItemManager : IItemManager
    {
        private readonly IItemRepository itemRepository;

        public ItemManager() : this(new ItemRepository())
        {
        }

        public ItemManager(IItemRepository itemRepository)
        {
            this.itemRepository = itemRepository;
        }

        public IEnumerable<ItemDto> GetItemByCategoryId(int catId)
        {
            return itemRepository.Find(item => item.CatId == catId).MapTo<ItemDto>();
        }
    }
}